<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="common/include :: header('客户拜访表')" />
</head>
<body class="gray-bg">
	<div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="post-form">
					<div class="select-list">
						<ul>
							<li>
								关键字：<input type="text" name="visitReason"/>
							</li>
                            <li>
                                拜访方式：
                                <select name="visitType" th:with="type=${@dict.getType('ep_visit_type')}">
                                    <option value="">所有</option>

                                    <option th:each="dict : ${type}" th:text="${dict.label}" th:value="${dict.value}"></option>
                                </select>
                            </li>
                            <li class="select-time">
                                <label>创建时间：</label>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="beginTime"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="endTime"/>
                            </li>
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
							    <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			<div class="btn-group-sm" id="toolbar" role="group">
				<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:post:add">
	                <i class="fa fa-plus"></i> 添加
	            </a>
	        </div>
	        <div class="col-sm-12 select-table table-striped">
			    <table id="bootstrap-table"></table>
			</div>
		</div>
	</div>
	<th:block th:include="common/include :: footer" />
	<script th:inline="javascript">
		var visitType = [[${@dict.getType('ep_visit_type')}]];
		var prefix = ctx + "/business/customerVisit";
		$(function() {
		    var options = {
		        url: prefix + "/customerVisitQuery",
		        createUrl: prefix + "/addPage",
		        columns: [
		        {
		            field: 'id',
		            title: '序号',
					visible: true,
                    formatter:function (value,row,index) {
                        //获取每页显示的数量
                        var pageSize = $('#bootstrap-table').bootstrapTable('getOptions').pageSize;
                        //获取当前是第几页
                        var pageNumber = $('#bootstrap-table').bootstrapTable('getOptions').pageNumber;
                        //返回序号
                        return pageSize * (pageNumber - 1) + index + 1;
                    }
		        },
		        {
		            field: 'customer.customerName',
		            title: '客户',
		            sortable: true
		        },
		        {
		            field: 'customerLinkMane.linkman',
		            title: '联系人',
		            sortable: true
		        },
		        {
		            field: 'visitReason',
		            title: '拜访原因',
		            sortable: true
		        },
				{
					field: 'visitType',
					title: '拜访方式',
					sortable: true,
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(visitType, value);
                    }
				},
				{
					field: 'visitDate',
					title: '拜访日期',
					sortable: true,
				},
				{
					field: 'content',
					title: '交流情况',
					sortable: true
				},
				{
					field: 'user.userName',
					title: '录入人',
					sortable: true
				},
                    {
                        field: 'inputTime',
                        title: '录入时间',
                        sortable: true
                    }]
		    };
		    $.table.init(options);
		});
	</script>
</body>
</html>